package com.azxc.rapid.plus.system.feign;

import com.azxc.rapid.core.launch.constant.AppConstant;
import com.azxc.rapid.core.tool.api.R;
import com.azxc.rapid.system.entity.*;
import com.azxc.rapid.system.vo.RegionTreeVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Feign接口类
 */
@FeignClient(
	value = "rapid-core-plus",
	fallback = IRegionPlusClientFallback.class
)
public interface IRegionPlusClient {

	String API_PREFIX = "/client";
	String GET_JURISDICTION_LIST_CITY = API_PREFIX + "/region/get_jurisdiction_by_city_code";
	String GET_CITY_LIST = API_PREFIX + "/region/get_city_list";
	String GET_BY_PARAMS = API_PREFIX + "/region/get_by_params";
	String GET_BY_CODE = API_PREFIX + "/region/get_by_code";
	String GET_BY_CODES = API_PREFIX + "/region/get_by_codes";
	String GET_BY_DEPT = API_PREFIX + "/region/get_by_dept";
	String GET_BY_GENERATE_DOC = API_PREFIX + "/region/get_by_generate_doc";
	String GET_CHILD_REGIONS_BY_CODE = API_PREFIX + "/region/get_child_regions_by_code";
	String GET_REGION_BY_CODE = API_PREFIX + "/region/get_region_by_code";
	String GET_LIST = API_PREFIX + "/region/get_list";
	String SELECT_REGION_CODE = API_PREFIX + "/region/select_region_code";
	String GET_TREE_BY_CODE = API_PREFIX + "/region/get_tree_by_code";

	String REGION_BY_NAME = API_PREFIX + "/getRegionByName";
	/**
	 * 获取市县列表
	 */
	@GetMapping(GET_CITY_LIST)
	R<List<Region>> getCityList(@RequestParam String cityCode);

	/**
	 * 根据市县获取管辖所列表
	 */
	@GetMapping(GET_JURISDICTION_LIST_CITY)
	R<List<Region>> getJurisdictionByCity(@RequestParam String cityCode,@RequestParam String jurisdictionLevel);

	/**
	 * 获取指定行政区划信息
	 */
	@GetMapping(GET_BY_CODE)
	R<Region> getByCode(@RequestParam String code);

	/**
	 * 批量查询行政区划信息
	 *
	 * @param codes 多个用逗号，拼接
	 */
	@GetMapping(GET_BY_CODES)
	R<List<Region>> getByCodes(@RequestParam String codes);

	/**
	 * 根据条件查询行政区划信息
	 *
	 * @param region 行政区划 {}
	 */
	@GetMapping(GET_BY_PARAMS)
	R<List<Region>> getByParams(Region region);

	/**
	 * 根据部门查询行政区划
	 *
	 * @param deptId 部门id
	 */
	@GetMapping(GET_BY_DEPT)
	R<Region> getByDept(@RequestParam("dept_id") Long deptId);

	/**
	 * 返回行政区划编码可生成文书的行政区划
	 *
	 * @param code 行政区划编码
	 */
	@GetMapping(GET_BY_GENERATE_DOC)
	R<Region> getByGenerateDoc(@RequestParam("code") String code);



	/**
	 * 根据code查询所有子区域相信
	 * @param code
	 * @return
	 */
	@GetMapping(GET_CHILD_REGIONS_BY_CODE)
	R<List<Region>> getChildRegionsByCode(@RequestParam("code") String code);

	/**
	 * 根据区域编码查询当前区域信息
	 * @param code
	 * @return
	 */
	@GetMapping(GET_REGION_BY_CODE)
	R<Region> getRegionByCode(@RequestParam("code") String code);

	@GetMapping(GET_LIST)
	R<List<Region>> getList();

	@GetMapping(SELECT_REGION_CODE)
	R<String> selectRegionCode(@RequestParam("cityCode") String cityCode);

	@GetMapping(GET_TREE_BY_CODE)
	R<RegionTreeVO> getTreeByCode(@RequestParam("parentCode") String parentCode);

	/**
	 * 根据行政区域名称查询出行政区域名称
	 *
	 * @param regionName
	 * @return
	 */
	@GetMapping(REGION_BY_NAME)
	R<Region> getRegionByName(@RequestParam("regionName") String regionName);
}
